package com.liveinstars.im.common.exception;

import com.liveinstars.im.common.enums.IMExceptionEnum;
import com.onepiece.shipelves.common.Result;
import com.onepiece.shipelves.common.exception.BaseException;
import lombok.Data;

/**
 * @author: zhouze
 * @date: 2020/4/7
 */
@Data
public class IMException extends Exception implements BaseException {

    private String code;

    private String message;

    public IMException(IMExceptionEnum imExceptionEnum) {
        this.code = imExceptionEnum.getCode();
        this.message = imExceptionEnum.getMessage();
    }

    @Override
    public Result createResult() {
        Result result = new Result();
        result.setCode(this.code);
        result.setMessage(this.message);
        return result;
    }
}
